<style>
.fui-header:after {
	height: 0;
	border-bottom: 0 solid #D9D9D9;
}
.search-input input {
	border-radius: 1rem;
	background-color:#f2f2f2;
	border: 0 solid #ddd;
}
.pickbrand{z-index:10000;position: fixed;top:0;right: 0.1rem;width: 7%;background-color: #F7F7F8;height: 100%;}
.pickbrand ul{list-style: none;text-align: center;line-height: 1.1rem;font-size: 0.7rem;right: 0.1rem;margin:auto;display: block;position: absolute;top: 0;left: 0;right: 0;bottom:0;}

</style>
<div ng-show="pagedata.showarea ==1">
<div class="fui-page fui-page-current page-goods-list" style="background:#fff">
	<div class="fui-header" style="background:none">
		<div class="fui-header-left">
			<a class="back" style="color:#fff" href="javascript:" ng-click="pagedata.showarea=0;tool.get_list('/index/getlist/',true)"></a>
		</div>
		<div class="title bold" style="font-size:1rem;">定位地址</div>
		<div class="fui-header-right" style="padding-right:0.5rem;">
			<i class="icon jinyunicon icon-fenxiang2" onclick="$('#showsharecover').modal();" style="font-size: 1rem;margin-right:10px"></i>
		</div>
	</div>
<div class="fui-content" style="margin-top:2.3rem;background:#fff">
		<div class="fui-cell-group">
			<div class="fui-cell">
				<div class="fui-cell-info">
					<span style="font-size:0.75rem"><span>当前定位/选择地区：{{pagedata.pcd.city || '广州市'}}</span></span>
					<i class="icon jinyunicon icon-moreunfold"></i>
				</div>
				<div ng-click="pagedata.uplocation(1);" class="fui-cell-remark noremark red" style="padding-left:0.3rem">
					重新定位
				</div>
			</div>
	    </div>
			<div class="weui_cells_title">热门地区</div>
			<div class="weui_cells">
				<div class="row margin0">
					<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('广东省','深圳市','');pagedata.showarea = 0;">
									<div>深圳市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('上海市','上海市','');pagedata.showarea = 0;">
									<div>上海市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('广东省','东莞市','');pagedata.showarea = 0;">
									<div>东莞市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('北京市','北京市','');pagedata.showarea = 0;">
									<div>北京市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('江苏省','南京市','');pagedata.showarea = 0;">
									<div>南京市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('江苏省','杭州市','');pagedata.showarea = 0;">
									<div>杭州市</div>
									<div class="clear"></div>
							</div>
						</div>
				</div>
		</div>
		<div ng-if="pagedata.params.py">
				<div class="weui_cells_title">搜索结果</div>
				<div class="weui_cells">
					<div class="row margin0">
						<div class="jy-3" ng-repeat="item in pagedata.citys">
								<div class="yuyue-duan" style="width:auto" ng-click="selectarea(item.province,item.name,'');pagedata.showarea = 0;">
										<div>{{item.name}}</div>
										<div class="clear"></div>
								</div>
						</div>
					</div>
				</div>
		</div>
		<div ng-if="!pagedata.params.py" ng-repeat="(value,data) in pagedata.province">
				<div class="weui_cells_title">{{value}}</div>
				<div class="weui_cells">
					<div class="row margin0">
						<div class="jy-3" ng-repeat="(city,data) in pagedata.province[value]">
								<div class="yuyue-duan" style="width:auto" ng-click="selectarea(value,city,'');pagedata.showarea = 0;">
										<div>{{city}}</div>
										<div class="clear"></div>
								</div>
						</div>
					</div>
				</div>
		</div>
</div>
<div class="pickbrand">
	<ul>
		<li ng-repeat="(key,value) in pagedata.num_list" ng-click="pagedata.getcitys(value)">
			<a href="javascript:;" class="external">{{value}}</a>
		</li>
		<li ng-click="pagedata.getcitys()"><a href="javascript:;" class="external">#</a></li>
	</ul>
</div>
</div>
</div>
<script>
scope.pagedata.num_list=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
scope.pagedata.addressinfo={}
scope.pagedata.uplocation=function(isup){
	if(scope.pagedata.pcd.street && !isup){
		if(scope.pagedata.params.isjianli==1){
			scope.tool.get_list('/jianlist/getlist/',true);
		}else{
			scope.tool.get_list('/index/getlist/',true);
		}
	}else{
		// 百度地图API功能
		window.scope.location(function(re){
			console.log(re)
			var lat_lng = re.lat_lng;
			scope.pagedata.params.showtype=scope.pagedata.showtype;
			scope.pagedata.params.lat=lat_lng.lat;
			scope.pagedata.params.lng=lat_lng.lng;
			scope.pagedata.pcd=re.addressComponents;
			scope.pagedata.pcd.street=scope.pagedata.pcd.street_recommend?scope.pagedata.pcd.street_recommend:scope.pagedata.pcd.street;
			scope.pagedata.params.city = scope.pagedata.pcd.city?scope.pagedata.pcd.city:'';
			scope.post_json('jy_51job/index/uppcd/',scope.pagedata.pcd,function(res){
				if(scope.pagedata.params.isjianli==1){
					scope.tool.get_list('/jianlist/getlist/',true);
				}else{
					scope.tool.get_list('/index/getlist/',true);
				}
			});
			if(isup){
				scope.message('定位成功');
				scope.$evalAsync();
			}	
		},'','',isup);
	}
}
scope.pagedata.getprovince=function(){
	if(scope.pagedata.isprovince){
		return '';
	}
	scope.get('jy_51job/index/getpcd/',function(res){
		scope.pagedata.province=res.areas
		scope.pagedata.isprovince=true
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
scope.pagedata.getcitys=function(py){
	py=py?py:''
	scope.pagedata.params.py=py;
	scope.get('jy_51job/index/getcitys/py='+py,function(res){
		scope.pagedata.citys=res.citys
		scope.$evalAsync();
	});
}
scope.pagedata.choose_location=function(obj,field,type){
		scope.modal_func(function(res){
			if(type && res[type]){
				var ret=res[type];
			}else{
				var ret=res;
			}
			console.log(res);
			scope.pagedata.params.lat=res.lat_lng.lat;
			scope.pagedata.params.lng=res.lat_lng.lng;
			scope.pagedata.pcd.street=res.title
			scope.$evalAsync();
		},'','core/tools.choose_location/');
}
scope.selectarea = function(province,city,district){
	scope.pagedata.pcd.province = province;
	scope.pagedata.pcd.city = city;
	scope.pagedata.pcd.district = district;
	scope.pagedata.showcity=0;
	scope.pagedata.params.city = city?city:'';
	scope.pagedata.params.district = district?district:'';
	scope.post_json('jy_51job/index/uppcd/',scope.pagedata.pcd,function(res){
		if(scope.pagedata.params.isjianli==1){
			scope.tool.get_list('/jianlist/getlist/',true);
		}else{
			scope.tool.get_list('/index/getlist/',true);
		}
	});
	scope.$evalAsync();
}
</script>